<%@page import="com.el.bojo.Student"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'handouts.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	"EL表达式":${username }
	<br />
	<%--因为我们没有往req里面存值,所以为空 --%>
	<%
		out.print(request.getParameter("username"));
	%>

	<%--el获取对象的属性 --%>
	<%
		Student student = new Student();
		student.setSno("16000");
		student.setRecordDate(new Date());
		String[] names = { "张三", "李四", "王五" };

		request.setAttribute("stu", student);
		request.setAttribute("sno", student.getSno());
		request.setAttribute("SNO", "SNO");
		request.setAttribute("s-sno", student.getSno());
		request.setAttribute("recorddate", student.getRecordDate());
		request.setAttribute("name", names);
	%>
	<%
		out.print("<br/>");
		out.print("Java脚本sno:" + request.getAttribute("sno"));
		out.print("<br/>");
		out.print("Java脚本SNO:" + request.getAttribute("SNO"));
		out.print("<br/>");
		out.print("Java脚本s-sno:" + request.getAttribute("s-sno"));
		out.print("<br/>");
		out.print("Java脚本:" + request.getAttribute("recorddate"));
		out.print("<br/>");
		String[] n = (String[]) request.getAttribute("name");
		out.print("Java脚本:" + n[1]);
		out.print("<br/>");
	%>
	"\${stu.sno }":${stu.sno }
	<br /> "\${sno }":${sno }
	<br />
	<%--EL表达式区分大小写 --%>
	"\${requestScope.sno }":${requestScope.sno }
	<br /> "\${requestScope.SNO }":${requestScope.SNO }
	<br /> "\${requestScope["s-sno"] }":${requestScope["s-sno"] }
	<br /> "\${recorddate }":${recorddate }
	<br /> "\${name[1] }":${name[1] }
	<br />
	<%--EL可以实现简单的自动类型转换--%>
	<%--如果我们使用getAttribute返回Object类型,还要转换成student才能使用 --%>
	<%--这里他自动转成了entity包下的student类 --%>
	"\${stu }":${stu }
	<br />
	<%--下面是可以直接在EL表达式中使用的文字 --%>
	<%--一共五种类型1.Boolean 2.任何正数或负数 3.任何正的或负的浮点数 
	 4.任何由单引号或双引号限定的String 5.null--%>
	${true }
	<br /> ${-454.567 }
	<br /> ${"/张三/" }
	<br /> ${"'张三'" }
	<br />

	<br /> ${'啊啊啊' }
	<br /> ${"啊啊啊" }
	<br /> ${"\\张三\\" }
	<br /> ${null }
	 \${3/4 } ${3/4 }

<%
		session.setAttribute("message","session中保存的值");
	 %>
	 <c:out value="${sessionScope.message}" default="默认值" escapeXml="false"></c:out>
	 <c:set var="scopeVar2" scope="session">HELLO</c:set>
	 scopeVar2=<c:out value="${scopeVar2}" /><br/>
</body>
</html>
